// 引入封装的 axios
import request from '@/utils/request'

// 获取部门负责人列表（也是获取员工简单列表）
export const getDepartmentsPrincipalRequest = () => request.get('/sys/user/simple')

// 获取员工列表
export const getEmployeesListRequest = ({ page, size }) => {
  return request.get('/sys/user', {
    params: {
      page,
      size
    }
  })
}

// 删除员工
export const delEmployeesRequest = (id) => request.delete(`/sys/user/${id}`)

// 新增员工
export const addEmployeesRequest = (addObj) => request.post('/sys/user', addObj)

// excel 批量导入员工
export const addEmployeesByExcelRequest = (addArr) => request.post('/sys/user/batch', addArr)

// 修改用户基本信息
export const changeEmployeesInfoRequest = (userInfoObj) => request.put(`/sys/user/${userInfoObj.id}`, userInfoObj)

// 获取员工个人详情信息
export const getEmployeesDetailUserInfoRequest = (id) => request.get(`/employees/${id}/personalInfo`)

// 保存员工个人信息
export const saveEmployeesDetailUserInfoRequest = (personalInfoObj) => request.put(`/employees/${personalInfoObj.userId}/personalInfo`, personalInfoObj)

// 获取员工岗位信息
export const getEmployeesJobInfoRequest = (id) => request.get(`/employees/${id}/jobs`)

// 保存员工岗位信息
export const saveEmployeesJobInfoRequest = (jobInfoObj) => request.put(`/employees/${jobInfoObj.userId}/jobs`, jobInfoObj)

// 给员工分配角色：
export const assignRolesRequest = (id, roleIds) => request.put('/sys/user/assignRoles', { id, roleIds })
